using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ProbeVisualizer : MonoBehaviour
{
    public GameObject visualGOTemp;
    public GameObject visualGORoot;
    
    public LightProbeGroup lightProbeGroup;
    public int lightProbeCountInGroup = 10;
    
    public IrradianceVolumeData irradianceVolumeData;
    
    public enum SampleDirection {MainLight, SceneCamera, Up, Down, Right, Left }
    public SampleDirection sampleDirection = SampleDirection.Up;

    public enum Channel { RGB, R, G, B }
    public ProbeVisualizer.Channel channel = Channel.RGB;
    
    public static Color FilterChannel(Color c, Channel ch = Channel.RGB)
    {
        switch (ch)
        {
            case Channel.R:   return new Color(c.r, 0,     0);
            case Channel.G:   return new Color(0,     c.g,   0);
            case Channel.B:   return new Color(0,     0,     c.b);
            default:          return c;
        }
    }
    
    public Vector3 GetSampleDirection()
    {
        switch (this.sampleDirection)
        {
            case SampleDirection.MainLight:
                if (RenderSettings.sun != null)
                    return RenderSettings.sun.transform.forward;
                break;
#if UNITY_EDITOR
            case SampleDirection.SceneCamera:
                return UnityEditor.SceneView.lastActiveSceneView.camera.transform.forward;
                break;         
#endif
            case SampleDirection.Up:
                return Vector3.up;
                break;
            case SampleDirection.Down:
                return Vector3.down;
                break;
            case SampleDirection.Left:
                return Vector3.left;
                break;
            case SampleDirection.Right:
                return Vector3.right;
                break;
        }
        return Vector3.zero;
    }
    
}
